import { Sprite } from './sprite'

export class Video {
  version = '2.0.0'
  
  videoSize: { // 画布的宽高
    width: number
    height: number
  }
  
  FPS: number // 每秒帧数
  
  frames: number // 帧数
  
  sprites: Sprite[]
  
  audios: any[]
  
  decodedImages: { [key: string]: any } = {}
  
  constructor(readonly props: any) {
    this.version = props.version
    
    this.videoSize = {
      width: props.params.viewBoxWidth || 0.0,
      height: props.params.viewBoxHeight || 0.0
    }
    
    this.FPS = props.params.fps || 20
    
    this.frames = props.params.frames || 0
    
    this.sprites = props.sprites?.map((v: any) => new Sprite(v)) ?? []
    
    this.audios = props.audios || []
  }
}